package com.example.treeHole.controller;

import com.example.treeHole.result.Result;
import com.example.treeHole.service.ArticleMainService;
import com.example.treeHole.service.VirtualCharacterService;
import com.example.treeHole.utils.BaseContext;
import com.example.treeHole.utils.Uuid;
import com.example.treeHole.vo.ArticleMain;
import com.example.treeHole.vo.VirtualCharacter;
import com.example.treeHole.vo.dto.ArticleMainDto;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/virtualCharacter")
public class VirtualCharacterController {

    @Autowired
    private VirtualCharacterService virtualCharacterService;

    @GetMapping("/findAll")
    public Result<List<VirtualCharacter>> findAll(){
        List<VirtualCharacter> virtualCharacterList=virtualCharacterService.findAll();
        return Result.success(virtualCharacterList);
    }

    @PostMapping("/create")
    public Result<Integer> create(@RequestBody VirtualCharacter virtualCharacter){
        return Result.success(virtualCharacterService.create(virtualCharacter));
    }

    @GetMapping("/findById/{id}")
    public Result<VirtualCharacter> findById(@PathVariable String id){
        return Result.success(virtualCharacterService.findById(id));
    }

    @GetMapping("/usedV")
    public Result<List<VirtualCharacter>> usedV(){

        return Result.success(virtualCharacterService.usedV());
    }

}
